<?php
    defined('IN_ADMIN') or exit('No permission resources.');
    $show_dialog = 1;
    include $this->admin_tpl('header', 'admin');
?>
<link rel="stylesheet" href="http://xs01.meituan.net/kui/1.8.2/css/@waimai/kangarooui.min.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<table class="table table-bordered">
  <thead>
  <tr>
    <th>编号</th>
    <th>姓名</th>
    <th>电话</th>
    <th>提问时间</th>
    <th>状态</th>
    <th>操作</th>
  </tr>
  </thead>
  <tbody>
  <?php
    if(is_array($data)){
	    foreach($data as $row){
    ?>
  <tr>
    <th scope="row"><?php echo $row['id'];?></th>
    <td><?php echo $row['username'];?></td>
    <td><?php echo $row['phone'];?></td>
    <td><?php echo date('Y-m-d H:i:s',$row['q_time']);?></td>
    <td>
      <?php
        if($row['is_ask']==1) {
          echo "<span class='fa fa-check text-success'> 已回复</span>";
        }else{
          echo "<span class='fa fa-close text-danger'> 暂无回复...</span>";
        }
      ?>
    </td>
    <td><a class="btn btn-primary btn-sm" href="###"
			onclick="edit(<?php echo $row['id']?>, '<?php echo new_addslashes(new_html_special_chars($row['username']))?>')"
            title="回复信息">回答</a>  
            <a class="btn btn-danger btn-sm" href='?m=ask&c=ask&a=delete&id=<?php echo $row['id']?>' onClick="return confirm('<?php echo L('confirm', array('message' => new_addslashes(new_html_special_chars($row['question']))))?>')"><?php echo L('delete')?></a> 
  </tr>
    <?php 
            }
        }
    ?>
  </tbody>
</table>
<div id="pages"><?php echo $pages?></div>

<script type="text/javascript">

function edit(id, name) {
	window.top.art.dialog({id:'edit'}).close();
	window.top.art.dialog({title:'回复'+name+' ',id:'edit',iframe:'?m=ask&c=ask&a=edit&id='+id,width:'700',height:'450'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
}

</script>